home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-12-07 | 5.5 KB | 204 lines |
- /*
- A basic extension of the java.applet.Applet class
- */
-
- import java.awt.*;
- import java.applet.*;
-
- public class ThreadX extends Applet {
- void stop3_Clicked(Event event) {
- pa3.stop();
- }
-
- void start3_Clicked(Event event) {
- pa3.resume();
- }
-
- void stop2_Clicked(Event event) {
- pa2.stop();
- }
-
- void start2_Clicked(Event event) {
- pa2.resume();
- }
-
- void stop1_Clicked(Event event) {
- pa1.stop();
- }
-
- void start1_Clicked(Event event) {
- pa1.resume();
- }
-
- void resetButton_Clicked(Event event) {
- stopButton_Clicked(null);
- pa1.reset();
- pa2.reset();
- pa3.reset();
- pa1.repaint();
- pa2.repaint();
- pa3.repaint();
- }
-
- void stopButton_Clicked(Event event) {
- pa1.stop();
- pa2.stop();
- pa3.stop();
- }
-
- void startButton_Clicked(Event event) {
- pa1.resume();
- pa2.resume();
- pa3.resume();
- }
-
-
- public void init() {
- super.init();
-
- // Take out this line if you don't use symantec.itools.net.RelativeURL
- symantec.itools.lang.Context.setDocumentBase(getDocumentBase());
-
- //{{INIT_CONTROLS
- setLayout(new BorderLayout(0,0));
- addNotify();
- resize(505,293);
- mainButtonPanel = new java.awt.Panel();
- mainButtonPanel.setLayout(new FlowLayout(FlowLayout.CENTER,20,10));
- mainButtonPanel.reshape(0,262,505,31);
- add("South", mainButtonPanel);
- startButton = new java.awt.Button("All Start");
- startButton.reshape(165,5,59,21);
- mainButtonPanel.add(startButton);
- stopButton = new java.awt.Button("All Stop");
- stopButton.reshape(229,5,58,21);
- mainButtonPanel.add(stopButton);
- resetButton = new java.awt.Button("Reset");
- resetButton.reshape(292,5,51,21);
- mainButtonPanel.add(resetButton);
- animationArea = new java.awt.Panel();
- animationArea.setLayout(new GridLayout(1,3,0,0));
- animationArea.reshape(0,0,505,262);
- add("Center", animationArea);
- aPanel1 = new java.awt.Panel();
- aPanel1.setLayout(new BorderLayout(0,0));
- aPanel1.reshape(0,0,168,262);
- aPanel1.setBackground(new Color(16711680));
- animationArea.add(aPanel1);
- ap1 = new java.awt.Panel();
- ap1.setLayout(new FlowLayout(FlowLayout.CENTER,5,25));
- ap1.reshape(0,0,168,231);
- aPanel1.add("Center", ap1);
- subP1 = new java.awt.Panel();
- subP1.setLayout(new FlowLayout(FlowLayout.CENTER,5,5));
- subP1.reshape(0,231,168,31);
- aPanel1.add("South", subP1);
- start1 = new java.awt.Button("Start");
- start1.reshape(41,5,41,21);
- subP1.add(start1);
- stop1 = new java.awt.Button("Stop");
- stop1.reshape(87,5,40,21);
- subP1.add(stop1);
- aPanel2 = new java.awt.Panel();
- aPanel2.setLayout(new BorderLayout(0,0));
- aPanel2.reshape(168,0,168,262);
- animationArea.add(aPanel2);
- ap2 = new java.awt.Panel();
- ap2.setLayout(new FlowLayout(FlowLayout.CENTER,5,25));
- ap2.reshape(0,0,168,231);
- aPanel2.add("Center", ap2);
- subP2 = new java.awt.Panel();
- subP2.setLayout(new FlowLayout(FlowLayout.CENTER,5,5));
- subP2.reshape(0,231,168,31);
- aPanel2.add("South", subP2);
- start2 = new java.awt.Button("Start");
- start2.reshape(41,5,41,21);
- subP2.add(start2);
- stop2 = new java.awt.Button("Stop");
- stop2.reshape(87,5,40,21);
- subP2.add(stop2);
- aPanel3 = new java.awt.Panel();
- aPanel3.setLayout(new BorderLayout(0,0));
- aPanel3.reshape(336,0,168,262);
- aPanel3.setBackground(new Color(255));
- animationArea.add(aPanel3);
- ap3 = new java.awt.Panel();
- ap3.setLayout(new FlowLayout(FlowLayout.CENTER,5,25));
- ap3.reshape(0,0,168,231);
- aPanel3.add("Center", ap3);
- subP3 = new java.awt.Panel();
- subP3.setLayout(new FlowLayout(FlowLayout.CENTER,5,5));
- subP3.reshape(0,231,168,31);
- aPanel3.add("South", subP3);
- start3 = new java.awt.Button("Start");
- start3.reshape(41,5,41,21);
- subP3.add(start3);
- stop3 = new java.awt.Button("Stop");
- stop3.reshape(87,5,40,21);
- subP3.add(stop3);
- //}}
-
- ap1.add(pa1);
- ap2.add(pa2);
- ap3.add(pa3);
- }
-
- public boolean handleEvent(Event event) {
- if (event.target == startButton && event.id == Event.ACTION_EVENT) {
- startButton_Clicked(event);
- }
- if (event.target == stopButton && event.id == Event.ACTION_EVENT) {
- stopButton_Clicked(event);
- }
- if (event.target == resetButton && event.id == Event.ACTION_EVENT) {
- resetButton_Clicked(event);
- }
- if (event.target == start1 && event.id == Event.ACTION_EVENT) {
- start1_Clicked(event);
- }
- if (event.target == stop1 && event.id == Event.ACTION_EVENT) {
- stop1_Clicked(event);
- }
- if (event.target == start2 && event.id == Event.ACTION_EVENT) {
- start2_Clicked(event);
- }
- if (event.target == stop2 && event.id == Event.ACTION_EVENT) {
- stop2_Clicked(event);
- }
- if (event.target == start3 && event.id == Event.ACTION_EVENT) {
- start3_Clicked(event);
- }
- if (event.target == stop3 && event.id == Event.ACTION_EVENT) {
- stop3_Clicked(event);
- }
- return super.handleEvent(event);
- }
-
- //{{DECLARE_CONTROLS
- java.awt.Panel mainButtonPanel;
- java.awt.Button startButton;
- java.awt.Button stopButton;
- java.awt.Button resetButton;
- java.awt.Panel animationArea;
- java.awt.Panel aPanel1;
- java.awt.Panel ap1;
- java.awt.Panel subP1;
- java.awt.Button start1;
- java.awt.Button stop1;
- java.awt.Panel aPanel2;
- java.awt.Panel ap2;
- java.awt.Panel subP2;
- java.awt.Button start2;
- java.awt.Button stop2;
- java.awt.Panel aPanel3;
- java.awt.Panel ap3;
- java.awt.Panel subP3;
- java.awt.Button start3;
- java.awt.Button stop3;
- //}}
-
- PolygonAnimation pa1 = new PolygonAnimation(100);
- PolygonAnimation pa2 = new PolygonAnimation(120);
- PolygonAnimation pa3 = new PolygonAnimation(150);
- }
-